package vnc.ui;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class Ethernetbit extends JPanel{
	
	String[] names;
	Object[] values;
	
	Point LocationBox = new Point(0,0);
	Dimension PaneSize = new Dimension(600,150); 
	JLabel jl= new JLabel();
	
	JButton FrameType;
	JButton SourceMac;
	JButton DestinationMac;
	
	Ethernetbit(){
		this.setLayout(null);
		this.setBackground(Color.white);
		
		FrameType = new JButton("Frame Type");
		SourceMac = new JButton("Source MAC");
		DestinationMac = new JButton("Destination MAC");
		
		
		this.add(FrameType);
		this.add(SourceMac);
		this.add(DestinationMac);
	
	}
void getInfos(final String[] names,final Object[] values){
		
		jl.setBounds(0, 150, 600, 20);
		this.add(jl);
	
		this.names = names;
		this.values = values;
		
		FrameType.setBounds(LocationBox.x, LocationBox.y,PaneSize.width/3, PaneSize.height/5);
		FrameType.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent arg0) {
				jl.setText(names[0]+" : "+values[0]);
			}
		});
		
		SourceMac.setBounds(LocationBox.x + FrameType.getWidth(), LocationBox.y,PaneSize.width/3, PaneSize.height/5);
		SourceMac.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent arg0) {
				jl.setText(names[1]+" : "+values[1]);
			}
		});
		DestinationMac.setBounds(LocationBox.x +FrameType.getWidth() + SourceMac.getWidth() , LocationBox.y,PaneSize.width/3, PaneSize.height/5);
		DestinationMac.addActionListener(new ActionListener(){
			public void actionPerformed(ActionEvent arg0) {
				jl.setText(names[2]+" : "+values[2]);
			}
		});
	
	}
}
